home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 11 / CU Amiga Magazine's Super CD-ROM 11 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-06].iso / cucd / programming / oberonv4 / source / system / in.mod (.txt) < prev    next >
Oberon Text  |  1996-08-11  |  3KB  |  99 lines

  1. Syntax10.Scn.Fnt
  2. Syntax10b.Scn.Fnt
  3. ParcElems
  4. Alloc
  5. MODULE In;  (* HM 18 March 1994; mah Fehler in In.Char *)
  6.     See, and update if necessary the history at the bottom of the file.
  7. IMPORT Display, Viewers, Texts, TextFrames, Oberon;
  8. CONST
  9.     inval* = Texts.Inval;
  10.     name* = Texts.Name;
  11.     string* = Texts.String;
  12.     int* = Texts.Int;
  13.     real* = Texts.Real;
  14.     longReal* = Texts.LongReal;
  15.     char* = Texts.Char;
  16.     Done-: BOOLEAN;
  17.     s: Texts.Scanner;
  18.     text: Texts.Text;
  19.     startpos: LONGINT;        (* reminder for In.char *)
  20. PROCEDURE OpenText* (t: Texts.Text; pos: LONGINT);
  21. BEGIN
  22.     text := t; Texts.OpenScanner(s, t, pos); startpos := pos; Done := TRUE
  23. END OpenText;
  24. PROCEDURE Open*;
  25.     VAR t: Texts.Text; beg, end, time: LONGINT; v: Viewers.Viewer; f: Display.Frame;
  26. BEGIN
  27.     OpenText(Oberon.Par.text, Oberon.Par.pos); Texts.Scan(s);
  28.     IF (s.class = Texts.Char) & (s.c = "^") THEN
  29.         Oberon.GetSelection(t, beg, end, time);
  30.         IF time > 0 THEN OpenText(t, beg) ELSE Done := FALSE END
  31.     ELSIF (s.class = Texts.Char) & (s.c = "*") THEN
  32.         (* start input stream at beginning of text in marked viewer *)
  33.         v := Oberon.MarkedViewer();
  34.         f := v.dsc;
  35.         WHILE (f # NIL) & ((Oberon.Pointer.Y < f.Y) OR (Oberon.Pointer.Y >= f.Y + f.H)) DO f := f.next END;
  36.         IF (f # NIL) & (f IS TextFrames.Frame) THEN
  37.             OpenText(f(TextFrames.Frame).text, 0)
  38.         ELSE Done := FALSE
  39.         END
  40.     ELSE OpenText(Oberon.Par.text, Oberon.Par.pos)
  41. END Open;
  42. PROCEDURE Next* (): INTEGER;
  43.     VAR s1: Texts.Scanner;
  44. BEGIN
  45.     IF Done THEN
  46.         Texts.OpenScanner(s1, text, Texts.Pos(s));
  47.         Texts.Scan(s1); Done := ~s1.eot; RETURN s1.class
  48.     ELSE RETURN inval
  49.     END;
  50. END Next;
  51. PROCEDURE Int* (VAR n: INTEGER);
  52. BEGIN
  53.     IF Done THEN
  54.         Texts.Scan(s);
  55.         IF s.class = int THEN n := SHORT(s.i) ELSE n := 0; Done := FALSE END
  56. END Int;
  57. PROCEDURE LongInt* (VAR n: LONGINT);
  58. BEGIN
  59.     IF Done THEN
  60.         Texts.Scan(s);
  61.         IF s.class = int THEN n := s.i ELSE n := 0; Done := FALSE END
  62. END LongInt;
  63. PROCEDURE Real* (VAR r: REAL);
  64. BEGIN
  65.     IF Done THEN
  66.         Texts.Scan(s);
  67.         IF s.class = real THEN r := s.x ELSE r := 0; Done := FALSE END
  68. END Real;
  69. PROCEDURE LongReal* (VAR r: LONGREAL);
  70. BEGIN
  71.     IF Done THEN
  72.         Texts.Scan(s);
  73.         IF s.class = Texts.LongReal THEN r := s.y ELSE r := 0; Done := FALSE END
  74. END LongReal;
  75. PROCEDURE Char* (VAR ch: CHAR);
  76. BEGIN
  77.     IF Done THEN
  78.         IF startpos = Texts.Pos (s) THEN Texts.Read (s, s.nextCh) END;
  79.         ch := s.nextCh; Done := ~s.eot;
  80.         Texts.Read(s, s.nextCh)
  81. END Char;
  82. PROCEDURE Name* (VAR name: ARRAY OF CHAR);
  83. BEGIN
  84.     IF Done THEN
  85.         Texts.Scan(s);
  86.         IF s.class = Texts.Name THEN COPY(s.s, name) ELSE COPY("", name); Done := FALSE END
  87. END Name;
  88. PROCEDURE String* (VAR string: ARRAY OF CHAR);
  89. BEGIN
  90.     IF Done THEN
  91.         Texts.Scan(s);
  92.         IF s.class = Texts.String THEN COPY(s.s, string) ELSE COPY("", string); Done := FALSE END
  93. END String;
  94. BEGIN
  95.     Done := FALSE
  96. END In.
  97. Date    Author    Modification
  98. 1996-07-31    claudio@dial.eunet.ch    First unified version.
  99.